package com.cyedu.tsapp.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cyedu.tsapp.entity.AppInfo;
import com.cyedu.tsapp.entity.Result;
import com.cyedu.tsapp.service.IAppInfoService;
import com.cyedu.tsapp.utils.ResultUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Garne
 * @since 2021-06-26
 */
@RestController
@RequestMapping("/appInfo")
public class AppInfoController {

    @Autowired
    IAppInfoService appInfoService;

    @ApiOperation(value = "获取应用列表", notes = "")
    @RequestMapping(value = "/getApps", method = RequestMethod.GET)
    public Result getApps(@RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
                           @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
        IPage<AppInfo> page = new Page<>(pageIndex, pageSize);
        return ResultUtil.success(appInfoService.page(page));
    }

}
